home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 September / CHIP Eylül 1998.iso / Slackwar / docs / mini / PLIP < prev    next >
Text File  |  1996-09-04  |  33KB  |  882 lines

  1.  
  2.             LINUX PLIP MINI-HOWTO
  3.  
  4. Last Update: 22/07/1996 (dd/mm/yyyy date format) 
  5. Copyright: 1996 by Andrea Controzzi <controzz@cli.di.unipi.it> 
  6.        See the copyright message below.
  7.  
  8. This HOWTO will hopefully let you build and use a Parallel Line Interface
  9. Protocol.
  10.  
  11. NOTE: this is the second release. There are many changes and lots of
  12. enhancements, but there will be surely grammar and spelling errors
  13. (english is not my native language) and, unlikely but possible, some 
  14. wrong or outdated info. PLEASE let me know about any errors to help me 
  15. provide the correct information for everybody.
  16.  
  17. For any question, error correction, comment and/or suggestion, my E-Mail
  18. address is: controzz@cli.di.unipi.it. Feel free to mail me any time you
  19. need help. Sometimes I won't answer immediately, but I'll answer. If it
  20. happens that you don't receive anything from me after 2 weeks, this means 
  21. that our mail system has trouble: do not hesitate to mail me again, it's 
  22. my duty to help you.
  23.  
  24. First of all, a lot of technical information come from the net-2-HOWTO, by
  25. Terry Dawson. This mini-HOWTO is not supposed to cover other aspects and/or 
  26. replace the net-2-HOWTO: my goal is to give you a way to install a PLIP
  27. permanent connection quickly, *ONLY* this. All the other info come from
  28. my personal experience and the help of many users that sent me comments
  29. and information.
  30.  
  31. Read the net-2-HOWTO and the other docs for the general information about
  32. the network and the config files I suggest to change.
  33.  
  34. The following is the index of the contents; you can quickly find the right
  35. paragraph searching for the string __nn__ where nn is the paragraph number.
  36.  
  37. INDEX
  38. =====
  39.  
  40. 0) Introduction: what is PLIP and why should I use it?
  41. 1) Hardware required to use PLIP.
  42. 2) Reconfigure the kernel.
  43. 3) Setting up the configuration files. 
  44. 4) Activate the PLIP link.
  45. 5) Kernel messages at boot time. 
  46. 6) FAQ.
  47. 7) A quick PLIP installation.
  48. 8) Patches to make PLIP and LP live together.
  49. 9) A PLIP LINK BETWEEN DOS AND LINUX
  50. 10) Questions? Comments? Send me feedback.
  51. 11) Where to find new releases of this mini-howto.
  52. 12) Credits.
  53. 13) Copyright message.
  54.  
  55.  
  56. __0__ INTRODUCTION: WHAT IS PLIP AND WHY SHOULD I USE IT?
  57.  
  58. There are many ways to create a connection between multiple hosts. PLIP,
  59. like SLIP, allow a local connection between two machines via the parallel
  60. ports.
  61.  
  62. A PLIP connection is very similar to the SLIP (with a leased cable) one,
  63. but uses parallel ports instead of the serial ports. Parallel ports
  64. transfer more than one bit at a time, this means it is possible to 
  65. achieve higher speeds than with a serial interface.
  66.  
  67. The PLIP interface is fast enough to allow some decent tcp/ip functions,
  68. like NFS. So, you may have a computer with all your Linux stuff and
  69. another with only the minimal system, where you can mount all the rest
  70. from the main machine.
  71.  
  72. The disadvantage is that most users have only one parallel port, this
  73. means that you won't be able to print and use PLIP together.  Until the
  74. last kernels, even with two or more parallel ports, using PLIP and the
  75. printer was impossible without using the kernel modules or other tricks.
  76.  
  77. This disvantage can be also eliminated, if you have two or more  parallel
  78. ports, applying a patch. Please see below in the "Patches to make PLIP and
  79. LP live together".
  80.  
  81. Finally I am now able to give a hopefully good way to set up a PLIP link
  82. between DOS and Linux.
  83.  
  84. __1__ HARDWARE REQUIRED TO USE PLIP
  85.  
  86. The hardware required to set up a PLIP interface is (obviously) a free
  87. parallel port in both the machines and the cable.
  88.  
  89. About the cable, this is what is written in the plip.c file, in the kernel
  90. 1.2.13 source:
  91.  
  92.   The cable used is a de facto standard parallel null cable -- sold as
  93.   a "LapLink" cable by various places.  You'll need a 12-conductor cable to
  94.   make one yourself.  The wiring is:
  95.     SLCTIN      17 - 17        
  96.     GROUND      25 - 25
  97.     D0->ERROR   2 - 15          15 - 2
  98.     D1->SLCT    3 - 13          13 - 3
  99.     D2->PAPOUT  4 - 12          12 - 4
  100.     D3->ACK     5 - 10          10 - 5
  101.     D4->BUSY    6 - 11          11 - 6
  102.   Do not connect the other pins.  They are
  103.     D5,D6,D7 are 7,8,9
  104.     STROBE is 1, FEED is 14, INIT is 16
  105.     extra grounds are 18,19,20,21,22,23,24
  106.  
  107. But I strongly advice you to read the /usr/src/linux/drivers/net/README1.PLIP
  108. file for more info about the cable.
  109.  
  110. In my opinion you should avoid building your own parallel null cable. A 
  111. self-made cable may save very little money, but can add lots of headaches.
  112. If you wish to build your parallel cable, remember that you're doing it at
  113. your own risk, I reported exactly what is written in plip.c but I don't give
  114. warranties.
  115.  
  116. A final word about cable length: long cables (i.e. more than 10 feet or
  117. 3 meters) may bring problems due to radio interference. If you need long
  118. cables you should use good and well shielded cables, but very long cables
  119. are not recommended: I think the maximal cable lenght should be 15 meters 
  120. (50 feet). 
  121.  
  122. Anyway, someone mailed me that his/her 100 foot (30 meters) cable works
  123. fine; if someone really wants to try a PLIP connection between the
  124. office and his home (200 meters away), and has the money to spend, then
  125. simply try it: in the worst case it just won't work!
  126.  
  127. __2__ RECONFIGURE THE KERNEL
  128.  
  129. You're supposed to already know how to configure and compile the kernel,
  130. otherwise you must get some doc (kernel-howto or other guides). Thanks to
  131. the cool work made by the kernel guys, recompiling the last kernels is a
  132. really easy jobs also for "common" people, so just do it. Anyway, for the
  133. sake of completeness, here is a quick summary of what you must do:
  134.  
  135. NOTE: I suppose you are using the 2.0.xx kernel series. Now there is
  136. no need to keep the 1.2.xx kernels.
  137.  
  138. I will suppose that you use menuconfig to set up the kernel options, but
  139. the other tools are equivalent. I'll show how to do it with menuconfig:
  140.  
  141.   #make menuconfig
  142.  
  143. I strongly advice to select
  144.  
  145.   Loadable module support  --->
  146.  
  147. and enable the 
  148.  
  149.    [*] Enable loadable module support
  150.  
  151. and, if possible (i.e. you have modules.2.0.0) the
  152.  
  153.    [*] Kernel daemon support (e.g. autoload of modules)
  154.  
  155. Then go back and choose
  156.  
  157.   Networking options  --->
  158.  
  159. where you should choose at least
  160.  
  161.    [*] Network firewalls
  162.    [*] TCP/IP networking
  163.    [*] IP: forwarding/gatewaying
  164.  
  165. The go back and choose at least
  166.  
  167.    [*] Network device support
  168.    <M> PLIP (parallel port) support
  169.  
  170. If you use modules I definitely advice you to set up PLIP as a module. If
  171. you do so you can also, if you need to use a printer, go to
  172.  
  173.   Character devices  --->
  174.  
  175. and set up as a module the
  176.  
  177. <M> Parallel printer support
  178.  
  179. Now you have enabled the kernel support for PLIP. If it's the first time
  180. that you compile the kernel look at all the other options then save and
  181. exit.
  182.  
  183. Finally compile with
  184.  
  185.   #make dep ; make clean
  186.   #make zlilo
  187.  
  188. And, if you use modules
  189.  
  190.   # make modules 
  191.   # make modules_install
  192.  
  193. __3__ SETTING UP THE CONFIGURATION FILES
  194.  
  195. First of all remember to backup all the files you will change, 
  196.  
  197.   #cp rc.inet1 rc.inet1.BACKUP 
  198.  
  199. may be a good idea.
  200.  
  201. Now, if you don't have it done already, you must choose the IP addresses
  202. of the two machines. In my examples I'll use a couple of example IPs for
  203. the IPs that you'll write, in the standard xxx.xxx.xxx.xxx format.
  204.  
  205. In the /etc/rc.d/inet1.rc file of both the machines add this (better if in 
  206. the last part of the file):
  207.  
  208. /sbin/route add -net ${NETWORK} netmask ${NETMASK}
  209.  
  210. Where NETWORK and NETMASK should be set up previously. If you don't know how 
  211. to do it, please read the NET-2-HOWTO. 
  212.  
  213. You may safely ignore these variables only in the following case:
  214.  
  215. If you only want to connect two machines on a standalone network, you may 
  216. pick-up any IP address, say 200.0.0.1 and 200.0.0.2 respectively.
  217. In this case you can safely put NETWORK="200.0.0.0" and NETMASK="255.255.255
  218. .0". These are the example IPs that I use in my Quick PLIP Installation (see
  219. below).
  220.  
  221.  
  222. NOTE: 200.0.0.1 and 2 are only example IPs, I advice not to use these
  223. numbers definitively because they could be the addresses of real
  224. hosts on Internet! 
  225.  
  226. I strongly advice to choose your address between the "private address"
  227. intervals:
  228.  
  229.       10.0.0.0        -   10.255.255.255
  230.           172.16.0.0      -   172.31.255.255
  231.           192.168.0.0     -   192.168.255.255
  232.  
  233. In the file /etc/hosts of both the machines you should add the entries with
  234. the IP of the machines that you connect via PLIP. In my example, the entries
  235. are:
  236.  
  237. 200.0.0.1       one             # this is the "one" IP address
  238. 200.0.0.2       two             # this is the "two" IP address
  239.  
  240. Where one and two are the names you have chosen for the two hosts.
  241.  
  242. If you want to activate the NFS, beside answering yes during the kernel
  243. configuration, you must add in /etc/exports the entries that describe the
  244. directories that you wish to export. In my example, to be able to mount
  245. the directory /usr, you should add this entry:
  246.  
  247.  /usr                          two (ro)
  248.  
  249.  
  250. __4__ ACTIVATE THE PLIP LINK
  251.  
  252.   Finally, these are the commands, that must be executed with root rights, 
  253. that activate the PLIP interface (of course the cable must be already plugged 
  254. correctly).
  255.  
  256. First of all confirm that there is no lp device present:
  257.  
  258.   #cat /proc/devices
  259.  
  260. You mustn't see any reference to lp like this:
  261.  
  262.  6 lp
  263.  
  264. Again I use the name one and two, as example. On "one" you must type:
  265.  
  266.   #ifconfig plip1 one pointopoint two up
  267.  
  268. Check that it worked...
  269.  
  270.   #ifconfig
  271.  
  272.  
  273.  
  274.  .....
  275.  .....
  276.  plip1     Link encap:10Mbps Ethernet  HWaddr FC:FC:C8:00:00:01
  277.            inet addr:200.0.0.1  P-t-P:200.0.0.2  Mask:255.255.255.0
  278.            UP POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1
  279.            RX packets:0 errors:0 dropped:0 overruns:0
  280.            TX packets:0 errors:0 dropped:0 overruns:0
  281.            Interrupt:7 Base address:0x378 
  282.  
  283. NOTE: if you use modules without the kerneld daemon (that autoloads the
  284. proper modules on demand) remember to 
  285.   
  286.   #insmod plip
  287.  
  288. before the ifconfig. If you are paranoic check that the module has been 
  289. loaded with:
  290.  
  291.   #lsmod
  292.  
  293. Module:        #pages:  Used by:
  294. plip               3            0
  295.  
  296. Add the route to two...
  297.  
  298.   #route add two
  299.  
  300. And, if you want also the NFS for two:
  301.  
  302.   #rpc.portmap
  303.   #rpc.mountd
  304.   #rpc.nfsd
  305.  
  306. On "two" the commands are the same, but you must write one instead of two 
  307. and vice versa.
  308.  
  309. One of your machines is likely to have only the PLIP connection, if this is
  310. true, you may also type:
  311.  
  312.   #route add default gw one
  313.  
  314. on that machine. In my example above, two is a laptop with only a PLIP
  315. connection with one, so I type the above line on two.
  316.  
  317. Finally check with a
  318.  
  319.   #ping two
  320.  
  321. from one and a
  322.  
  323.   #ping one 
  324.  
  325. from two to see that all is working.
  326.  
  327. Of course you may want to have all these commands automatically done by a
  328. script or at boot time. You must only create a script that execute these
  329. commands: now you may invoke it as root when you need, or you may add a
  330. command (in /etc/rc.d/rc.inet2) that calls it at boot time. If you want to
  331. use my Quick PLIP Installation, you will find all the config files and the
  332. script. NOTE: this file may be outdated...sorry.
  333.  
  334. __5__ KERNEL MESSAGES AT BOOT TIME
  335.  
  336. After you've reconfigured and compiled the kernel with PLIP support enabled,
  337. examine the messages with the dmesg (8) command.
  338.  
  339. You should get something like this:
  340.  
  341. NET3 PLIP version 2.0 gniibe@mri.co.jp
  342. plip1: Parallel port at 0x378, using assigned IRQ 7.
  343.  
  344. Of course if you're using modules you'll see this message when you (or
  345. the kerneld daemon) insmods the plip.o module. Depending upon your
  346. klogd and syslogd configuration the plip message could have been stored
  347. in your system log files: don't panic if you don't see the above message.
  348. If lsmod shows that the plip module is loaded, then it's enough.
  349.  
  350. __6__ FAQ
  351.  
  352. This section will (hopefully) solve your problems. If you have any other
  353. question, feel free to mail me anytime.
  354.  
  355. The question is listed with a =, the answer(s) with a -
  356.  
  357. = I get these messages at boot time:
  358.     SIOCSIFADDR: No such device
  359.     SIOCADDRT: Network is unreachable
  360.   and when I try to set up the link as written above, I get again error
  361.   messages like:
  362.     SIOCSIFADDR: No such device
  363.     SIOCSIFDSTADDR: No such device
  364.     SIOCADDRT: Network is unreachable
  365.     mount clntudp_create: RPC: Port Mapper failure - RPC: Unable to send
  366. - The kernel, for some reason, hasn't PLIP support enabled. This could be
  367.   due to:
  368.    . You didn't answer yes to "PLIP support? " during kernel configuration.
  369.    . You answered yes to "Printer support? " during kernel configuration.
  370.    . You compiled PLIP as a module, so you must load it. 
  371.  
  372. = Is there a way to support both PLIP and LP, beside modules, perhaps with
  373.   two parallel ports?
  374. - Yes, so far there are two ways, described in the "Patches to make PLIP
  375.   and LP live together":
  376.   . You can apply a patch to make the kernel support both.
  377.   . You can apply another patch to make the kernel use a parallel port
  378.     for PLIP and another for LP. 
  379.  
  380. = I have created the script that connects my 2 computers. I set up the
  381.   link automatically in my rc.inet2, where I call a script that creates
  382.   the link and enables VFS.
  383.   My "two" hosts mounts some "one"'s directories; I have added the 
  384.   correct entries in "two"'s /etc/fstab.
  385.   If I boot "two" when "one" is down, "two" halts for some minutes 
  386.   on the "mounting remote file systems...".
  387. - This happens because "two" waits to mount the "one" filesystems, but
  388.   if "one" is down you must wait until "two" is bored of waiting.
  389.   To avoid this, you may:
  390.    . Comment out in rc.inet2 the command that mounts the remote filesystems
  391.    . Remove the entry in "two"'s /etc/fstab and mount the remote filesystems
  392.      manually when and if you need.
  393.  
  394. = My link is up, but ping fails. I receive the following message from the 
  395.   kernel:       plip1: timed out (1, 89)
  396. - This means that the "your side of the link" is working, your machine
  397.   sends the signal, but the "other side" isn't answering for the following
  398.   reasons:
  399.   . The cable isn't plugged properly or is broken or is wrong.
  400.   . The "other side" machine has not PLIP up.
  401.   . You are linked with a notebook with a not proper parallel port, see
  402.     next question.
  403.  
  404. = I have installed the PLIP connection but if I ping I get 100% data loss.
  405.   I connected my desktop with a notebook.
  406. - Some notebook's parallel ports aren't good for PLIP, because they are
  407.   only "printer ports", i.e. they can only transmit but not receive the
  408.   data. So far I don't know if there is a way to make them work.
  409.   The only hope is:
  410.   . Look at your notebook setup, perhaps there is a way to configure
  411.     the parallel port as a parallel port instead of a printer port.
  412.   . Try plip mode 0. Alas I don't know how to do it and/or if it works
  413.     or is still available in the last kernels.
  414.  
  415. = What speeds can I achieve with PLIP?
  416. - This is an hard question to answer to, because there are MANY factors
  417.   that can change deeply your performance:
  418.   . The CPU speed on both the sides of the link.
  419.   . The parallel port type and settings.
  420.   . The system load.
  421.   . What do you use PLIP for.
  422.   Just to give a rough idea, you should achieve about 40Kbytes/sec, much
  423.   faster than any serial rate and near to a low-level ethernet card.
  424.  
  425. = What happens if I need to ifconfig up and ifconfig down many times plip1?
  426. - Seems that you need to add a -arp to the ifconfig command, except for
  427.   the first time after each boot. I don't need, but perhaps someone does.
  428.  
  429. = I have read the IP numbers reserved for private networks and your 200.0.0.1
  430.   and 200.0.0.2 are not in these ranges. Shouldn't they be changed?
  431. - Yes, they should. But as I underline since the beginning I choose these
  432.   IP addresses only because of their simplicity, you are free to change
  433.   them as you wish. Here is a cut from the net-2-howto:
  434.   
  435.     RFC1597 has specifically reserved some IP addresses for private
  436.     networks.  You should use these as they prevent anything nasty
  437.     happening if you accidentally get connected to the Internet. The
  438.     addresses reserved are:
  439.  
  440.       10.0.0.0        -   10.255.255.255
  441.       172.16.0.0      -   172.31.255.255
  442.       192.168.0.0     -   192.168.255.255
  443.  
  444. = Is there a way to fine tune PLIP parameters without editing the source
  445.   code?
  446. - Yes, there is! Try the /sbin/plipconfig command. See the man page for more
  447.   info.
  448.  
  449. = I'm running Debian GNU/Linux, and under Debian, the files /etc/rc.d/rc.inet1
  450.   and 2 do not exist. Where must I write the plip configuration commands?
  451. - In Debian GNU/Linux you must edit /etc/init.d/network, where you have to 
  452.   put all the commands that should stay in rc.inet1 and 2.
  453.  
  454. = I have some problems linking two hosts with PLIP. The first has the latest
  455.   kernel, the second still uses the 1.0.x PLIP version: is this a problem?
  456. - Yes, it's much better, where is possible, to have the same PLIP version on 
  457.   both ends.
  458.  
  459. = PLIP support in some 1.3.x kernel doesn't work. What happens?
  460. - Remember that 1.oddnumber.x kernels are under development: the "gods"
  461.   that work hard every day to make linux better than the day before
  462.   sometimes fail to give us "mortals" stable kernels. Right now a kernel
  463.   2.0.xx release should be stable.
  464.  
  465. __7__ A QUICK PLIP INSTALLATION
  466.  
  467. Before doing this mini-HOWTO, I created a quick PLIP installation set of
  468. files. In few minutes, beside compiling the kernel, you should be able to
  469. set up a PLIP interface. The tarred and gzipped set of files may be found
  470. on my Home Page, at
  471.  
  472. http://www.cli.di.unipi.it/~controzz/intro.html
  473.  
  474. Perhaps someone will let my files available at some ftp site.
  475.  
  476. __8__ PATCHES TO MAKE PLIP AND LP LIVE TOGETHER
  477.  
  478. The best way to make PLIP and LP live together is to use kernel modules: you
  479. can load plip.o and unload it when you need to print or vice versa.
  480. If you do really need to use both PLIP and LP, try the following patches.
  481.  
  482.   _8.1_ PLIP AND LP TOGETHER ON THE SAME PORT
  483. If for some reason you wish PLIP and LP supported directly by the kernel, 
  484. you can try these patches.
  485.  
  486. You must modify the following pieces of code, but *backup* the files
  487. before:
  488.  
  489. --- begin ---
  490.  
  491. ******** modifications to linux/drivers/char/lp.c ***********************
  492. struct lp_struct lp_table[] = {
  493.         { 0x3bc, 0, 0, LP_INIT_CHAR, LP_INIT_TIME, LP_INIT_WAIT, NULL,
  494. NULL, },
  495. /*      { 0x378, 0, 0, LP_INIT_CHAR, LP_INIT_TIME, LP_INIT_WAIT, NULL,
  496. NULL, },
  497.         { 0x278, 0, 0, LP_INIT_CHAR, LP_INIT_TIME, LP_INIT_WAIT, NULL,
  498. NULL, },
  499. */
  500. };
  501. #define LP_NO 1
  502.  
  503. ******** modifications to linux/drivers/net/Space.c ********************
  504. #if defined(PLIP) || defined(CONFIG_PLIP)
  505.     extern int plip_init(struct device *);
  506.     static struct device plip2_dev = {
  507.         "plip2", 0, 0, 0, 0, 0x278, 2, 0, 0, 0, NEXT_DEV, plip_init, };
  508.     static struct device plip1_dev = {
  509.         "plip1", 0, 0, 0, 0, 0x378, 7, 0, 0, 0, &plip2_dev, plip_init, };
  510. /*    static struct device plip0_dev = {
  511.         "plip0", 0, 0, 0, 0, 0x3BC, 5, 0, 0, 0, &plip1_dev, plip_init, };
  512. */
  513. #   undef NEXT_DEV
  514. #   define NEXT_DEV     (&plip1_dev)
  515. #endif  /* PLIP */
  516.  
  517. ---end---
  518.  
  519. Of course there is the standard disclaimer: I received these patches and
  520. I put them "as I got them". This means that you try them at your own risk.
  521. Anyway, your biggest trouble should be only restore the original files and
  522. recompile.
  523.  
  524.   _8.2_ PLIP AND LP ON DIFFERENT PORTS
  525. If you have at least 2 parallel ports you can try these patches, that
  526. should allow you to use PLIP on a port and LP on the other.
  527.  
  528. --- begin ---
  529.  
  530. 1. Comment out one line in kernel source file, drivers/char/lp.c.
  531.  
  532. struct lp_struct lp_table[] = {
  533. { 0x3bc, 0, 0, LP_INIT_CHAR, LP_INIT_TIME, LP_INIT_WAIT, NULL, NULL, },
  534. { 0x378, 0, 0, LP_INIT_CHAR, LP_INIT_TIME, LP_INIT_WAIT, NULL, NULL, },
  535. /* { 0x278, 0, 0, LP_INIT_CHAR, LP_INIT_TIME, LP_INIT_WAIT, NULL, NULL, }, */
  536. }; 
  537.     3 -> 2
  538.  
  539. 2. Kernel configuration
  540.  
  541.     PLIP (parallel port) support (CONFIG_PLIP) [n] y
  542.  
  543.     Parallel Printer support [y] y
  544.  
  545. 3. Kernel message at startup
  546.  
  547.     lp1 at 0x0378, using polling driver
  548.     .....
  549.     NET3 PLIP version 2.0 gniibe@mri.co.jp
  550.     plip2: Parallel port at 0x278, using assigned IRQ 5.
  551.  
  552. ---end---
  553.  
  554. Again the standard disclaimer, like section 8.1.
  555.  
  556.  
  557. __9__  A PLIP LINK BETWEEN DOS AND LINUX
  558.  
  559. After the first release of this Mini-HowTo many people wrote for info about
  560. a link between Linux and DOS (or Windows) computer. The general interest
  561. lead me to add this chapter, I hope will be of help to everybody.
  562.  
  563. This section comes from an article I've found on Linux Gazzette by James 
  564. McDuffie <mcduffie@scsn.net> . It covers the basic installation of a PLIP
  565. link between Linux and a DOS computer using Windows and Trumpet WinSock
  566. and gives the address of a cool program that let's you run X-Windows
  567. programs on Windows.
  568.  
  569. The next section is an addendum sent by James Vahn <jvahn@short.circuit.com>
  570. where he describes deeply how to set up this link and how to solve many
  571. problems. 
  572.  
  573. I suppose you have already set up properly the PLIP support on the Linux
  574. side and you have got the right cable, else go back to the previous chapters.
  575.  
  576. Now, for the DOS side, you need first of all a packet driver. It can be
  577. found here:
  578.  
  579. ftp://ftp.crynwr.com/drivers/plip.zip 
  580.  
  581. The program runs under DOS and acts like a Ethernet Packet driver. 
  582. If you want to use PLIP with Windows you need also Trumpet Winsock. This 
  583. serves as the TCP/IP interface. Otherwise, you can probably find TCP/IP 
  584. software for DOS.
  585.  
  586. Now go back to the Linux computer and add the DOS computer address to
  587. /etc/hosts. If your DOS computer does not have a registered IP address
  588. you may choose any address (remember the warning of chapter 3 about IP
  589. addresses). 
  590.  
  591. Now let's suppose you chose the name linux for the Linux computer and dos 
  592. for the DOS one. You have to type:
  593.  
  594. ifconfig plip1 linux pointopoint dos arp up
  595. route add dos
  596.  
  597. Of course if you want to have this done every time you boot the linux
  598. computer you may add these lines to the file /etc/rc.d/rc.inet1:
  599.  
  600. /sbin/ifconfig plip1 linux pointopoint dos arp up
  601. /sbin/route add dos
  602.  
  603. This sets up the interface and then adds a route to it. Of course if you
  604. are using the second parallel port you have to write plip2 instead.
  605.  
  606. Go back to the DOS/Windows computer and edit autoexec.bat, you have to
  607. add the following lines.
  608.  
  609. c:\plip\plip.com 0x60
  610. c:\tcpip\winsock\winpkt.com 0x60
  611.  
  612. Of course I suppose you put plip.com (the packet driver) in the directory
  613. c:/plip and the winpkt.com in c:/tcpip, else you need to put the right path.
  614.  
  615. This sets the plip.com program on packet vector 0x60 and then loads the 
  616. winpkt.com program that comes with trumpet winsock on the same vector. 
  617. If the cable is something other than lpt1 you will have to tell plip.com 
  618. the irq number and io address. Also, winpkt.com needs to run to make the
  619. packet vector avaliable to Windows. From here we go to the actual setup 
  620. under Trumpet Winsock. All you have to do is unselect SLIP or PPP and 
  621. enter 60 into the box labeled Packet vector. Then tell it the IP address 
  622. you gave it, the IP address of the Linux computer as the default gateway 
  623. and the Name Server as either you computer's ip or your ISP's address 
  624. for its nameservers if your going to connect it to the Internet (more on 
  625. this later). Close the setup and re-run Winsock and you should have it! 
  626. Put winsock in your startup group and you have everything setup automatically! 
  627.  
  628. If you want to access the Internet through the Linux computer on the Windows 
  629. computer you will need to set up IP Masquerading, for info on this see the 
  630. NET-2-HOWTO. This simply masquerades the Windows computer with your Linux 
  631. computer's IP address. 
  632.  
  633. Also I have found a program that lets you run X-Windows programs under 
  634. Windows! It is located at: 
  635.  
  636. http://www.tucows.com/ 
  637.  
  638. Set it up according to directions and then all you have to do is telnet 
  639. in from the Windows computer then set the display to the Windows computer 
  640. (`DISPLAY=duncan:0.0` for instance) and run the program desired. 
  641. There is nothing cooler than running xv under Windows! Hope all this helped. 
  642.  
  643.   _9.1_ A DOS-LINUX PLIP LINK EXPERIENCE.
  644.  
  645. NOTE: I received this document from James Vahn <jvahn@short.circuit.com> and
  646. I put it here unchanged. This means that for any question about this section 
  647. he's much better qualified than me so please mail to him before to me.
  648. His experience with a PLIP connection of a floppy-only DOS computer to a
  649. Linux one is the perfect example of how to work-around common problems.
  650.  
  651. Last Update 11/07/1996 (dd/mm/yyyy format)
  652. addendum from <jvahn@short.circuit.com>
  653.  
  654. My floppy-only DOS box is networked via PLIP to the second printer port on
  655. the Linux machine. The first Linux printer port has a printer on it, both are
  656. permanently connected and the DOS box is telnet'd into Linux. These are my 
  657. notes on what I did to accomplish this.
  658.  
  659. When the kernel probes for printer ports, it will grab all of them unless you
  660. remove one from the probe. Otherwise PLIP will get nothing. One method is to
  661. load the drivers as modules when needed... 
  662.  
  663. <gniibe@mri.co.jp> writes:
  664. =========================
  665. I keep recommending using PLIP/LP as kernel module, since 
  666.  
  667.     * modules are flexible for change of configuration
  668.     * (re)compiling the kernel is not easy for novice users
  669.     * co-existing PLIP and LP is only feasible by the modules
  670.  
  671. With PLIP/LP as kernel module, you can specify which port is PLIP and
  672. which port is LP.  Here is example:
  673.  
  674.     # insmod lp.o io=0x378
  675.     # insmod plip.o io=0x278 irq=2
  676.  
  677. Even you can use two parallel ports:
  678.  
  679.     # insmod plip.o io=0x278,0x3bc irq=2,5
  680.  
  681. In the example above, 
  682. plip0 is assigned on 0x278 and it's irq is 2,
  683. plip1 is assigned on 0x3bc and it's irq is 5, respectively.
  684.  
  685. =========================
  686.  
  687. Using modules certainly sounds like the way to go. The following method shows
  688. how to patch the kernel to allow both a printer and PLIP on different ports,
  689. without modules. If you are unfamiliar with the module concept, you might
  690. find this quicker to set up.
  691.  
  692. You will need to modify two files in the kernel source tree. I'm using kernel
  693. 1.2.13 and found some changes were needed in ../linux/drivers/net/Space.c to
  694. accommodate my system. Look at around line 205 for the PLIP definitions to
  695. make sure your port and IRQ match, and make a note of which driver it will be
  696. (plip0, plip1, plip2). In my case port 0x278 uses IRQ 5 (the card is jumpered
  697. that way) but Space.c defined it with IRQ 2. I made the changes here, rather
  698. than opening up the box and changing jumpers. The alternative is to specify
  699. the IRQ through ifconfig later on, but the kernel will boot up with the wrong
  700. IRQ for PLIP and it may annoy you. It is a simple (single character) change.
  701.  
  702. The next, and more difficult step--  
  703. In .../drivers/char/lp.c you will find the following at around line 38:
  704.  
  705. struct lp_struct lp_table[] = {
  706.     { 0x3bc, 0, 0, LP_INIT_CHAR, LP_INIT_TIME, LP_INIT_WAIT, NULL, NULL, },
  707.     { 0x378, 0, 0, LP_INIT_CHAR, LP_INIT_TIME, LP_INIT_WAIT, NULL, NULL, }, 
  708. /*  { 0x278, 0, 0, LP_INIT_CHAR, LP_INIT_TIME, LP_INIT_WAIT, NULL, NULL, }, 
  709.  * 0x278 reserved for plip1
  710.  *
  711.  * }; 
  712.  * #define LP_NO 3 
  713.  */
  714. }; 
  715. #define LP_NO 2 
  716.  
  717. Notice the changes to make- one port is commented out, so now only 2 ports
  718. are defined. Port 0x3BC will probably not work for PLIP- the IRQ line is
  719. usually broken on these ports, as found on old monochrome adapters (MDA).
  720.  
  721. You made backups of these file before you changed them, right?  Now make a
  722. new kernel with printer, net, dummy, and plip support.
  723.  
  724. Configure the system. This is my /etc/rc.d/rc.inet1 file:
  725.  
  726. #!/bin/bash
  727. #
  728. /sbin/ifconfig lo 127.0.0.1
  729. /sbin/route add -net 127.0.0.0
  730.  
  731. /sbin/ifconfig dummy 200.0.0.1
  732. /sbin/route add -net 200.0.0.0 netmask 255.255.255.0
  733. /sbin/ifconfig plip1 arp 200.0.0.1 pointopoint 200.0.0.2 up
  734. /sbin/route add 200.0.0.2
  735. /sbin/ifconfig dummy down
  736.  
  737. Notice that arp is used for the DOS-to-Linux connection, apparently not used
  738. on Linux-to-Linux connections.
  739.  
  740. And in /etc/hosts you can add these, just to give the two machines names:
  741.  
  742. 200.0.0.1    console1
  743. 200.0.0.2    console2
  744.  
  745. The DOS box is console2. Note Andrea's warning about these, better to use
  746. official numbering schemes. 
  747.  
  748. Reboot so all of these changes and the new kernel will take effect. During
  749. the boot sequence (or by running dmesg) if you made the patches, otherwise
  750. when the modules are loaded:
  751.  
  752. lp0 at 0x03bc, using polling driver
  753. lp1 at 0x0378, using polling driver
  754. [....]
  755. NET3 PLIP version 2.0 gniibe@mri.co.jp
  756. plip1: Parallel port at 0x278, using assigned IRQ 5.
  757.  
  758. The "route" command shows this:
  759.  
  760. Kernel routing table
  761. Destination     Gateway         Genmask         Flags MSS    Window Use Iface
  762. console2        *               255.255.255.255 UH    1436   0      136 plip1
  763. loopback        *               255.0.0.0       U     1936   0      109 lo
  764.  
  765. And "ifconfig plip1" shows:
  766.  
  767. plip1     Link encap:10Mbps Ethernet  HWaddr FC:FC:C8:00:00:01
  768.           inet addr:200.0.0.1  P-t-P:200.0.0.2  Mask:255.255.255.0
  769.           UP POINTOPOINT RUNNING  MTU:1500  Metric:1
  770.           RX packets:132 errors:0 dropped:0 overruns:0
  771.           TX packets:136 errors:0 dropped:0 overruns:0
  772.           Interrupt:5 Base address:0x278 
  773.  
  774. Look at /etc/inetd.conf and see if telnet is enabled. You might want to read
  775. the man page for tcpd, and the use of /etc/hosts.allow (ALL: LOCAL) and 
  776. /etc/hosts.deny (ALL: ALL). You should be able to "telnet localhost".
  777.  
  778. Linux is done, now the DOS side. Again, be suspicious of port 0x3BC if one is
  779. present.
  780.  
  781. I'm using NCSA's telnet and Crynwr's PLIP driver found at these sites:
  782. ftp://ftp.ncsa.uiuc.edu/Telnet/DOS/ncsa/tel2308b.zip 
  783. ftp://ftp.crynwr.com/drivers/plip.zip
  784.  
  785. Be sure to use NCSA's version 2.3.08 telnet and version 11.1 of Crynwr's
  786. PLIP driver. Please find and read Crynwr's SUPPORT.DOC located elswhere. 
  787.  
  788. The CONFIG.TEL file.  Most of it is the default and to save some space
  789. I've tried to cut it back here to just the info you need (hopefully). The
  790. second port on this machine is setup as 0x278 on IRQ 5.
  791.  
  792. myip=200.0.0.2 
  793. netmask=255.255.255.0       # subnetting mask
  794. hardware=packet             # network adapter board (packet driver interface)
  795. interrupt=5                 # IRQ which adapter is set to
  796. ioaddr=60                   # software interrupt vector driver is using
  797. #
  798. #[...lots unchanged...]
  799. #
  800. # at the end of the file, put this line:
  801. name=console1 ; hostip=200.0.0.1 ; nameserver=1 ; gateway=1 
  802.  
  803. (console1 is the name of the Linux machine, you can use whatever you like)
  804.  
  805. I made a 12 foot null cable between both machines, and (after initially
  806. finding it miswired) there have been no problems. A standard 11-wire null
  807. printer cable should work too. The Linux plip.c source shows the wiring.
  808. Although my cable has the 17-17 connection, I don't think it is used for
  809. anything and was not present on a ready-made cable.
  810.  
  811. @echo off
  812. plip.com 0x60 5 0x278
  813. telbin -s console1
  814.  
  815. That should connect you to the Linux box on /dev/ttyp. NCSA's telnet
  816. provides for 8 virtual screens and also acts as an ftp server. The PLIP
  817. interface provides a fair throughput, I'm getting 6.5K/s file transfers
  818. with my antiques. Let's hope you can do better.  :-)
  819.  
  820. __10__ QUESTIONS? COMMENTS? SEND ME FEEDBACK
  821.  
  822. For any questions and comments you can find me via e-mail at the address
  823. controzz@cli.di.unipi.it
  824.  
  825. Feedback is welcome, any error report is precious.
  826. The next release should have a larger FAQ section, if you send questions.
  827.  
  828. __11__ WHERE TO FIND NEW RELEASES OF THIS MINI-HOWTO
  829.  
  830. This mini-HOWTO is maintained by the HOWTO coordinators and is posted
  831. monthly on comp.os.linux.answers and can be found in the HOWTO directory
  832. at sunsite and at sunsite's mirrors.
  833.  
  834. Another way to find the mini-HOWTO (and to contact me) is on my Home Page,
  835.  
  836. http://www.cli.di.unipi.it/~controzz/intro.html
  837.  
  838. __12__ CREDITS.
  839.  
  840. Many thanks to:
  841.  
  842. o Rick Lim <ricklim@freenet.vancouver.bc.ca> for the patches to make PLIP
  843.   and LP live together.
  844.  
  845. o Takeshi Okazaki <GBA03552@niftyserve.or.jp> for the patches to use PLIP
  846.   and LP on two different parallel ports.
  847.  
  848. o Jim Van Zandt <jrv@vanzandt.mv.com> for some advice on the "tutorial" part
  849.   of this HOWTO.
  850.  
  851. o James Vahn <jvahn@short.circuit.com> for the cool addendum on the PLIP
  852.   between DOS and Linux chapter.
  853.  
  854. o To all the ones that posted PLIP-related articles on the linux newsgroups
  855.   and/or mailed me. The list of all the people that helped me with info
  856.   and comments could be longer than the Mini-HOWTO itself: thank you all!
  857.  
  858. __13__ COPYRIGHT MESSAGE
  859.  
  860. Unless otherwise stated, Linux HOWTO documents are copyrighted by
  861. their respective authors. Linux HOWTO documents may be reproduced and
  862. distributed in whole or in part, in any medium physical or electronic,
  863. as long as this copyright notice is retained on all copies. Commercial
  864. redistribution is allowed and encouraged; however, the author would
  865. like to be notified of any such distributions.
  866.  
  867. All translations, derivative works, or aggregate works incorporating
  868. any Linux HOWTO documents must be covered under this copyright notice.
  869. That is, you may not produce a derivative work from a HOWTO and impose
  870. additional restrictions on its distribution. Exceptions to these rules
  871. may be granted under certain conditions; please contact the Linux
  872. HOWTO coordinator at the address given below.
  873.  
  874. In short, we wish to promote dissemination of this information through
  875. as many channels as possible. However, we do wish to retain copyright
  876. on the HOWTO documents, and would like to be notified of any plans to
  877. redistribute the HOWTOs.
  878.  
  879. If you have questions, please contact Greg Hankins, the Linux HOWTO
  880. coordinator, at gregh@sunsite.unc.edu via email.
  881.  
  882.